<?php
require_once 'models/orm.inc';
require_once 'models/publisher.inc';

/**
 * 
 * @author kras
 * @property IItemPublisher $Publisher
 */

class TMSPublicableItemModel extends TCandyModel {
/**
 * @var IItemPublisher[]
 */
	protected $_ioc_publisher_ = array();

	protected function postEditItem(TCandyItem $item, $origin, array $data = array()){
		if (is_array($this->Publisher))
			foreach ($this->Publisher as $pub){
			$pub->OnItemChange($item);
		}
	}
	
	public function DeleteItem($id){
		if ($item = $this->GetItem($id)){
			if (is_array($this->Publisher))
				foreach ($this->Publisher as $pub)
				$pub->OnItemDelete($item);
			parent::DeleteItem($id);
		}
	}	
}